<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增客户')" />
	<th:block th:include="include :: datetimepicker-css" />
	<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-customer-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">姓名：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">手机号：</label>
				<div class="col-sm-8">
					<input id="phone" name="phone" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">身份证号：</label>
				<div class="col-sm-8">
					<input id="idCard" name="idCard" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">性别：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
					</div>
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">客户状态：</label>
				<div class="col-sm-8">
					<input id="status" name="status" class="form-control" type="text">
				</div>
			</div>-->
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">创建者：</label>
				<div class="col-sm-8">
					<input id="createBy" name="createBy" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">创建时间：</label>
				<div class="col-sm-8">
					<input id="createTime" name="createTime" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">更新者：</label>
				<div class="col-sm-8">
					<input id="updateBy" name="updateBy" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">更新时间：</label>
				<div class="col-sm-8">
					<input id="updateTime" name="updateTime" class="form-control" type="text">
				</div>
			</div>-->


			<!--<div class="form-group">
				<label class="col-sm-3 control-label">出生日期：</label>
				<div class="col-sm-8">
					<div class="form-group">
						<div class="input-group date">
							<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
							<input type="text" class="time-input" id="birthday" name="birthday" placeholder="出生日期" />
						</div>
					</div>

				</div>
			</div>-->
			<div class="form-group draggable">
				<label class="col-sm-3 control-label">出生日期：</label>
				<div class="col-sm-8">
					<div class="input-group date">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" id="birthday" name="birthday" class="form-control" value="">
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">学历：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select id="qualification" name="qualification" class="form-control m-b" th:with="type=${@dict.getType('qualification')}">
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						</select>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">省份：</label>
				<div class="col-sm-8">
					<!--<input id="province" name="province" class="form-control" type="text">-->
					<div class="input-group" >
						<div data-toggle="distpicker">
							<select id="province" name="province"  style="padding: 6px 12px;border:1px solid #e5e6e7"></select>
							<select id="city" name="city" style="padding: 6px 12px;border:1px solid #e5e6e7"></select>
						</div>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">家庭住址：</label>
				<div class="col-sm-8">
					<input id="address" name="address" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">婚姻状态：</label>
				<div class="col-sm-8">
					<select id="marriage" name="marriage" class="form-control m-b" th:with="type=${@dict.getType('marriage')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">客户类型：</label>
				<div class="col-sm-8">
					<select id="type" name="type" class="form-control m-b" th:with="type=${@dict.getType('customerType')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">级别：</label>
				<div class="col-sm-8">
					<select id="level" name="level" class="form-control m-b" th:with="type=${@dict.getType('customerLevel')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">来源：</label>
				<div class="col-sm-8">
					<select id="source" name="source" class="form-control m-b" th:with="type=${@dict.getType('customerSource')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">客户状态：</label>
				<div class="col-sm-8">
					<select id="status2" name="status2" class="form-control m-b" th:with="type=${@dict.getType('customerType2')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">客户经理：</label>
				<div class="col-sm-8">
					<div class="input-group">
						<input name="managerId"  id="treeId" type="hidden" >
						<input name="managerName" onclick="selectUserTree()" id="treeName" type="text" placeholder="请选择客户经理" class="form-control" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">话务员：</label>
				<div class="col-sm-8">
					<div class="input-group">
						<input name="hwyId"  id="treeHwyId" type="hidden" >
						<input name="hwyName" onclick="selectHwyTree()" id="treeHwyName" type="text" placeholder="请选择话务员" class="form-control" required>
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">资金需求：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width:100%">
						<input id="moneyRequire" name="moneyRequire" class="form-control" type="text" >
						<span class="input-group-btn">
								<button class="btn btn-primary" type="button">万元</button>
							</span>
						</input>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">资金用途：</label>
				<div class="col-sm-8">
					<input id="moneyUse" name="moneyUse" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">下次跟进时间：</label>
				<div class="col-sm-8">
					<div class="input-group date">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						<input type="text" id="nextFollowDate" name="nextFollowDate" class="form-control" value="">
					</div>
				</div>
			</div>

			<!--<div class="form-group">
				<label class="col-sm-3 control-label">房产：</label>
				<div class="col-sm-8">
					<input id="fc" name="fc" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">车辆：</label>
				<div class="col-sm-8">
					<input id="car" name="car" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">保险：</label>
				<div class="col-sm-8">
					<input id="bx" name="bx" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">信用卡：</label>
				<div class="col-sm-8">
					<input id="creditCard" name="creditCard" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">负债：</label>
				<div class="col-sm-8">
					<input id="fz" name="fz" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">：</label>
				<div class="col-sm-8">
					<input id="contact" name="contact" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">跟进：</label>
				<div class="col-sm-8">
					<input id="follow" name="follow" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">签约：</label>
				<div class="col-sm-8">
					<input id="contract" name="contract" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">收款：</label>
				<div class="col-sm-8">
					<input id="sk" name="sk" class="form-control" type="text">
				</div>
			</div>-->
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea name="remark" autocomplete="off" maxlength="500" class="form-control" rows="3"></textarea>
				</div>
			</div>
		</form>
	</div>

	<th:block th:include="include :: footer" />
	<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
	<th:block th:include="include :: datetimepicker-js" />
	<th:block th:include="include :: select2-js" />
	<th:block th:include="include :: distpicker-js" />

    <script>
		var prefix = ctx + "crm/customer"
		$("#form-customer-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-customer-add').serialize());
	        }
	    }
		$(".input-group.date").datetimepicker({
			format: "yyyy-mm-dd",
			minView: "month",
			autoclose: true
		});

		/*选择用户树*/
		function selectUserTree() {
			var treeId = $("#treeId").val();
			var url = ctx + "system/user/selectUserTree";
			var options = {
				title: '选择用户',
				width: "310",
				height: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero){
			var tree = layero.find("iframe")[0].contentWindow.$._tree;
			var body = layer.getChildFrame('body', index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			layer.close(index);
		}

		/*选择用户树*/
		function selectHwyTree() {
			var treeId = $("#treeId").val();
			var url = ctx + "system/user/selectUserTree";
			var options = {
				title: '选择用户',
				width: "310",
				height: "380",
				url: url,
				callBack: doHwySubmit
			};
			$.modal.openOptions(options);
		}

		function doHwySubmit(index, layero){
			var tree = layero.find("iframe")[0].contentWindow.$._tree;
			var body = layer.getChildFrame('body', index);
			$("#treeHwyId").val(body.find('#treeId').val());
			$("#treeHwyName").val(body.find('#treeName').val());
			layer.close(index);
		}


		$(function(){
			$("#distpicker").distpicker();
		});
	</script>
</body>
</html>
